//
//  MSLChannelViewCell.m
//  MSLNews
//
//  Created by lirenqiang on 16/6/12.
//  Copyright © 2016年 lirenqiang. All rights reserved.
//

#import "MSLChannelViewCell.h"

@implementation MSLChannelViewCell {
    UILabel * _label;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        _label = [[UILabel alloc] init];
        
        _label.center = self.contentView.center;
        [self.contentView addSubview:_label];
    }
    return self;
}

- (void)setTname:(NSString *)tname {
    _tname = tname;
    
    if (self.selected) {

        _label.font = [UIFont systemFontOfSize:channelFontS];
        _label.textColor = UIColor.redColor;

    } else {
        
        _label.font = [UIFont systemFontOfSize:channelFontN];
        _label.textColor = UIColor.blackColor;
        
    }
    
    _label.text = tname;
    [_label sizeToFit];


}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    _label.center = self.contentView.center;
    
    _label.frame = CGRectMake((self.contentView.bounds.size.width - _label.bounds.size.width) / 2, (self.contentView.bounds.size.height - _label.bounds.size.height) / 2, _label.bounds.size.width, _label.bounds.size.height);
    
}

@end
